home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
simula
/
compiler
/
cim
/
sun4del2.lha
/
libcim.a
/
simset.sim
< prev
next >
Wrap
Text File
|
1992-08-23
|
2KB
|
107 lines
% $Id: simset.sim,v 1.1 1992/08/23 19:09:21 cim Exp $
%ifdef included
%else
%timestamp simset
%endif
%nonetest off
%cacesensitive on
CLASS SIMSET;
BEGIN
CLASS LINKAGE;
BEGIN REF(LINKAGE)zzsuc,zzpred;
REF(LINK) PROCEDURE SUC;
SUC:- IF zzsuc IN LINK THEN zzsuc ELSE NONE;
REF(LINK) PROCEDURE PRED;
PRED:- IF zzpred IN LINK THEN zzpred ELSE NONE;
REF(LINKAGE) PROCEDURE PREV; PREV:-zzpred;
END LINKAGE;
LINKAGE CLASS LINK;
BEGIN
PROCEDURE OUT;
IF zzsuc=/=NONE THEN BEGIN
zzsuc.zzpred:-zzpred;
zzpred.zzsuc:-zzsuc;
zzsuc:-zzpred:-NONE;
END OUT;
PROCEDURE FOLLOW(PTR); REF(LINKAGE)PTR;
BEGIN OUT;
IF PTR=/=NONE AND THEN PTR.zzsuc=/=NONE THEN BEGIN
zzpred:-PTR;
zzsuc:-PTR.zzsuc;
zzsuc.zzpred:-PTR.zzsuc:-THIS LINKAGE END
END FOLLOW;
PROCEDURE PRECEDE(PTR); REF(LINKAGE)PTR;
BEGIN OUT;
IF PTR=/=NONE AND THEN PTR.zzpred=/=NONE THEN BEGIN
zzsuc:-PTR;
zzpred:-PTR.zzpred;
zzpred.zzsuc:-PTR.zzpred:-THIS LINKAGE END
END PRECEDE;
PROCEDURE INTO(S); REF(HEAD)S; PRECEDE(S);
END LINK;
LINKAGE CLASS HEAD;
BEGIN
REF(LINK) PROCEDURE FIRST;
!FIRST:-SUC;
FIRST:- IF zzsuc IN LINK THEN zzsuc ELSE NONE;
REF(LINK) PROCEDURE LAST;
!LAST:-PRED;
LAST:- IF zzpred IN LINK THEN zzpred ELSE NONE;
BOOLEAN PROCEDURE EMPTY; EMPTY:= zzsuc==THIS LINKAGE;
INTEGER PROCEDURE CARDINAL;
BEGIN INTEGER I;
REF(LINKAGE) PTR;
% PTR:-FIRST;
% WHILE PTR =/= NONE DO BEGIN
% I:=I+1;
% PTR:-PTR.SUC;
% END WHILE;
PTR:-zzsuc;
WHILE PTR =/= THIS LINKAGE DO BEGIN
I:=I+1;
PTR:-PTR.zzsuc;
END WHILE;
CARDINAL:=I
END CARDINAL;
% PROCEDURE CLEAR; WHILE FIRST=/= NONE DO FIRST.OUT;
PROCEDURE CLEAR;
BEGIN
REF(LINKAGE) PTR,PTRSUC;
PTR:-zzsuc;
WHILE PTR =/= THIS LINKAGE DO
BEGIN
PTRSUC:-PTR.zzsuc;
PTR.zzsuc:-PTR.zzpred:-NONE;
PTR:-PTRSUC;
END;
zzsuc:-zzpred:-THIS LINKAGE
END;
zzsuc:-zzpred:-THIS LINKAGE
END HEAD;
END SIMSET;
%CACESENSITIVE OFF
%eof